home *** CD-ROM | disk | FTP | other *** search
/ Die Ultimative Software-P…i Collection 1996 & 1997 / Die Ultimative Software-Pakete CD-ROM fur Atari Collection 1996 & 1997.iso / g / gnu_c / gemlib30.zoo / test / uw / windefs.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-09-28  |  7.3 KB  |  263 lines

  1. /* header file with various definitions
  2.  */
  3.  
  4. /* this one should really be in stdio.h ...
  5.  */
  6.  
  7. #ifndef NULL
  8. #define NULL ((char *) 0)
  9. #endif
  10.  
  11. #define TRUE 1
  12. #define FALSE 0
  13.  
  14. /* constants
  15.  */
  16.  
  17. #define ALTINDICATOR '\05'
  18. #define MAXFUNCLEN 41  /* Maximum length of function key string */
  19. #define BREAK_TICKS 20 /* length of break in clock() ticks (5ms * 20 = .1s) */
  20. #define MAXSCROLLED 8
  21. #define MAX_WIND 8
  22. #define NFSTRINGS 42            /* number of function keys */
  23. #define WI_WITHSLD (SIZER|UPARROW|DNARROW|VSLIDE|LFARROW|RTARROW|HSLIDE)
  24. #define WI_NOSLD (NAME|MOVER|CLOSER|FULLER)
  25.  
  26.  
  27. #define WI_ROWS 80
  28. #define WI_LINES 24
  29. #define WI_WCHAR 8
  30. #define WI_HCHAR 16
  31. #define WI_WPIX (WI_ROWS*WI_WCHAR+16)
  32. #define WI_WWORDS ((WI_WPIX+15)/16)
  33. #define WI_HPIX (WI_LINES*WI_HCHAR)
  34. #define WI_SIZE ((long)WI_WWORDS*WI_HPIX*2)
  35. #define XON '\021'
  36. #define XOFF '\023'
  37.  
  38. #define xmitcmd(x)    { Bconout(1, IAC); Bconout(1, CB_DIR_MTOH|x); }
  39.  
  40. #define MINMAX(x, y, z) ( x<y ? y : (x>z ? z :x) )
  41.  
  42. #define HASHBITS 9        /* number of bits of hash for character lookup*/
  43.  
  44. #define FM_INVERT 12        /* logic parameter to copy_fm */
  45. #define FM_COPY    3        /* copy source to dest    */
  46.  
  47. #define X0 1
  48. #define Y0 1
  49.  
  50. /* emulation FSM states
  51.  */
  52.  
  53. #define S_NORMAL    0
  54. #define S_ESC        1
  55. #define S_ESC1        2
  56. #define S_ESC2        3
  57. #define S_ESC3        4
  58. #define S_STATUS    5
  59. #define S_ESCA        6
  60.  
  61. #define min(a,b) ( a < b ? a : b )
  62. #define max(a,b) ( a > b ? a : b )
  63. /* data types used
  64.  */
  65.  
  66. typedef struct mfdb {
  67.   short *ptr;            /* ptr to memory holding the image */
  68.   short wpix;            /* width in pixels */
  69.   short hpix;            /* height in pixels */
  70.   short wwords;            /* width in words */
  71.   short format;            /* 0 for machine-dependent */
  72.   short planes;            /* 1 for hires screen */
  73. } MFDB;
  74.  
  75. typedef struct {
  76.   unsigned char h_t[1<<HASHBITS];    /* hash table */
  77.   struct {
  78.     char h_try;                /* try this character next */
  79.     char h_next;            /* index of next entry in table */
  80.   } h_colision[128];            /* colision lists formed here */
  81. } HTBL;
  82.  
  83. typedef struct fnt {
  84.   int inc_x, inc_y;        /* real size of one char */
  85.   int def_win_x, def_win_y;    /* default window size in chars for this font */
  86.   HTBL f_hash;            /* hash table for this font */
  87.   char f_data[2048];        /* character data */
  88. } FNT;
  89.  
  90. typedef struct wi_str {
  91.   int port;            /* the UW port identifier */
  92.   int fulled,used;        /* flags */
  93.   int inverse;            /* inverse chars */
  94.   int insmode;            /* insert mode on */
  95.   int curstate;            /* state of the cursor */
  96.   int x, y, w, h;        /* work area on screen */
  97.   int px, py, pw, ph;        /* previous location of entire window */
  98.   int x_off, y_off;        /* offset for visible part */
  99.   int px_off, py_off;        /* previous offset */
  100.   int m_off;            /* memory offset */
  101.   int wi_w, wi_h;        /* max w,h */
  102.   int cur_x, cur_y;        /* current cursor position */
  103.   int top_y;            /* position of top of circular window buffer */
  104.   int state;            /* state for the emulation FSM */
  105.   FNT *font;            /* the font in use */
  106.   MFDB wi_mf;            /* memory form for this window */
  107.   char name[80];        /* name of this window */
  108.   char nuname[80];        /* new name under construction */
  109.   char dname[80];        /* name actually displayed (w/ flags, etc.) */
  110.                 /* (dname is set in w_rename) */
  111.   int nuptr;            /* curr. len of new name or parameter assembly*/
  112.   int ptr_status;        /* status of print loging for window */
  113.   int x_chrs, y_chrs;        /* size of terminal emulation */
  114.   int top_age;            /* number of windows topped after this window */
  115.   int wi_style;            /* style of window (see WI_*SLD) */
  116.   char wi_fpath[80];        /* log file path */
  117.   char wi_fname[20];        /* log file name */
  118.   FILE *wi_lfd;            /* log file descriptor */
  119.   int kerm_act;            /* is this a kermit window? */
  120.   int w_local;            /* is this a local window? */
  121. } WI_STR;
  122.  
  123. #define LOG_BOTOM    1    /* print incoming characters */
  124. #define LOG_TOP        2    /* print lines which scroll off screen top */
  125. #define LOG_NONE    0    /* no printer output for this window */
  126.  
  127. typedef struct gemfont {
  128.     short    ft_id;
  129.     short    ft_psize;
  130.     char    ft_name[32];
  131.     short    ft_l_ade;
  132.     short    ft_h_ade;
  133.     short    ft_topl;
  134.     short    ft_ascl;
  135.     short    ft_halfl;
  136.     short    ft_descl;
  137.     short    ft_botl;
  138.     short    ft_chwidth;
  139.     short    ft_clwidth;
  140.     short    ft_lf_off;
  141.     short    ft_rt_off;
  142.     short    ft_thick;
  143.     short    ft_ul;
  144.     short    ft_light;
  145.     short    ft_skew;
  146.     short    ft_flags;
  147.     short    *ft_h_off;
  148.     short    *ft_c_off;
  149.     short    *ft_data;
  150.     short    ft_fwidth;
  151.     short    ft_fheight;
  152.     struct gemfont *ft_next;
  153. } GEMFONT;
  154.  
  155. typedef char FUNCSTRING[MAXFUNCLEN];
  156.  
  157. #ifdef __GNUC__
  158. #include "retro.h"
  159. #include <stdlib.h>
  160. #include <stddef.h>
  161. #include <string.h>
  162. #include <unixlib.h>
  163. #include <stdio.h>
  164. #include <memory.h>
  165.  
  166. #ifndef __NO_PROTO__
  167.  
  168. /* kermit.c */
  169. int kerminit ( int curwin );
  170. int kermterm ( void );
  171. int kermtimchk ( void );
  172. int sendsw ( void );
  173. int sinit ( void );
  174. int sfile ( void );
  175. int sdata ( void );
  176. int seof ( void );
  177. int sbreak ( void );
  178. int recsw ( void );
  179. int rinit ( void );
  180. int rfile ( void );
  181. int rdata ( void );
  182. int spack ( int type , int num , int len , char *data );
  183. int rpack ( int *len , int *num , char *data );
  184. int bufill ( char buffer []);
  185. int bufemp ( char buffer [], int len );
  186. int gnxtfl ( void );
  187. int spar ( char data []);
  188. int rpar ( char data []);
  189. /* int printmsg ( char *fmt , int a1 , int a2 , int a3 , int a4 , int a5 ); */
  190. int prerrpkt ( char *msg );
  191.  
  192. /* winhash.c */
  193. int char_at ( int wdes , int x_loc , int y_loc );
  194. int which_char ( FNT *font , HTBL *htbl , char *pa );
  195. void gen_hash ( FNT *font , HTBL *htbl );
  196. int hash_char ( char *pa , int height );
  197. int dump_line ( int wdes , int y_coord );
  198. int dump_window ( int wdes );
  199. int copy_word ( int wdes , int x1 , int y1 , char *buffer );
  200. int copy_text ( int wdes , int x1 , int y1 , int x2 , int y2 , char *buffer );
  201.  
  202. /* winio.c */
  203. FNT *loadfont ( char *name );
  204. int read_config ( char *path , char *name );
  205. int write_config ( char *path , char *name );
  206. int setcapture ( WI_STR *wp );
  207. int getrsconf ( void );
  208. int setrsconf ( void );
  209. void rsbufset ( int bufsiz );
  210.  
  211. /* winmain.c */
  212. char *locate ( char *name );
  213. int startup ( void );
  214. int finish ( void );
  215. int memory ( void );
  216. int main ( void );
  217. int printer_mark ( int wnd );
  218. int s_dial ( int tree , int action );
  219. int set_menu_string ( char *newstr , int object );
  220. int size_dial ( void );
  221.  
  222. /* winproc.c */
  223. int do_exec ( void );
  224. int do_path ( void );
  225.  
  226. /* winproto.c */
  227. int proto_out ( int outport , char *str , int length );
  228. int proto_close ( int curwind );
  229. int proto_in ( void );
  230.  
  231. /* winsubr.c */
  232. char *getmem ( long size );
  233. #ifndef __GNUC__
  234. int bzero ( char *ptr , long size );
  235. #endif
  236. int find_port ( int wnd );
  237. int find_wind ( int port );
  238. int w_open ( int port , char *name , int xsiz , int ysiz );
  239. int w_closei ( int wdes );
  240. int w_close ( int wdes );
  241. int w_resize ( int wdes , int xsiz , int ysiz );
  242. int w_rename ( int wdes , char *name );
  243. int w_redraw ( int wdes , int logic , int xx , int yy , int ww , int hh );
  244. int w_update ( int wdes , int logic , int xx , int yy , int ww , int hh );
  245. int w_move ( int wdes , int xx , int yy , int ww , int hh );
  246. int w_top ( int win );
  247. int w_bottom ( void );
  248. int w_hide ( void );
  249. int w_shrink ( int wdes );
  250. int w_full ( int wdes );
  251. int w_arrow ( int wdes , int arrow );
  252. int w_slide ( int wdes , int hor , int val );
  253. int sethslide ( int wdes );
  254. int setvslide ( int wdes );
  255. int w_flash ( int wdes , int state );
  256. int w_output ( int wdes , char *ptr );
  257. int lineerase ( struct wi_str *wp , int first , int last );
  258. int scrollup ( struct wi_str *wp , int first , int nlines , int amount );
  259. int scrolldn ( struct wi_str *wp , int first , int nlines , int amount );
  260.  
  261. #endif /* __NO_PROTO__ */
  262. #endif /* __GNUC__ */
  263.